using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using TMPro;
using Unity.VisualScripting;
using UnityEngine.SceneManagement;
//游戏入口脚本
public class GameOverUI : UIBase
{
    void Awake()
    {
        GameApp.instance.enemyMove = false;
        Time.timeScale = 0;
        //开始游戏
        Register("重新开始").onClick = onStartBtn;
        Register("返回").onClick = onBackBtn;

    }
    //设置
    private void onStartBtn(GameObject obj, PointerEventData pData)
    {
        //关闭界面
        Close();
        //切换BGM
        AudioManager.Instance.PlayBGM("background");
        GameApp.instance.Init();
        //显示游戏界面
        UIManager.Instance.ShowUI<GameUI>("游戏界面");
        //显示虚拟界面
        UIManager.Instance.ShowUI<VirtualUI>("虚拟");
        MapController.instance.Init();
        
    }

    private void onBackBtn(GameObject obj, PointerEventData pData)
    {
         //关闭界面
        Close();
        //切换BGM
        AudioManager.Instance.PlayBGM("StartBackground");
        GameApp.instance.Init();
        //显示loginUI界面
        UIManager.Instance.ShowUI<LoginUI>("开始界面");
    }
}